<template>
	<div>
		<div style="background:url(http://lak110.gitee.io/gdapp/src/images/banner2.png);background-size:cover;">
			<div class="status-top"></div>
		</div>
		<div style="padding:1rem;">
			<mt-field label="原密码" placeholder="请输入原密码" v-model="oldPwd"></mt-field>
			<mt-field label="新密码" placeholder="请输入新密码" v-model="newPwd"></mt-field>
		</div>

		<div style="text-align: center;" @click="changePwd()">
			<mt-button type="primary">确定修改</mt-button>
		</div>
	</div>
</template>

<script>
	import {
		setStoreSession,
		getStoreSession
	} from '../../config/mUtils'
	export default {
		components: {

		},
		data() {
			return {
				info: {
					userId: "",
					oldPassword: "",
					newPassword: ""
				},
				oldPwd: '',
				newPwd: '',

			}
		},
		methods: {
			changePwd() {
				if (this.oldPwd == '' || this.newPwd == '') {
					this.$mint.Toast({
						message: '密码值不能为空',
						iconClass: 'iconfont icon-cuo',
						duration: 1500
					});
					return;
				}
				this.info.oldPassword=this.$md5(this.oldPwd+'{1q@!}');
				this.info.newPassword=this.$md5(this.newPwd+'{1q@!}');
				this.$axios.post('emeterInterface/user/updatePassword', this.info).then((p) => {
					console.log(p)
					if (p.data.error == '100') {
						this.$mint.Toast({
							message: '密码修改成功',
							iconClass: 'iconfont icon-dui',
							duration: 1500
						});
					}
				})
			}
		},
		created() {
			this.info.userId = getStoreSession('userInfo').userId;
		},
		mounted() {

		}
	}
</script>

<style lang="scss">
	.status-top {
		height: 2.97rem;
		background-position: 0% 0%;
		background-size: 100% 100%;
		background-repeat: no-repeat;
		background-image: url(http://lak110.gitee.io/gdapp/src/images/wave.gif);
		mix-blend-mode: screen;
		vertical-align: middle;
	}
</style>
